import os
import sys
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.common.action_chains import ActionChains
class LikeShopTest():
    def __init__(self) -> None:

        driver_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(sys.executable)))),
                               'geckodriver.exe')
        service = FirefoxService(executable_path=driver_path)
        options = webdriver.FirefoxOptions()
        self.browser = webdriver.Firefox(service=service, options=options)

    def test(self):
        self.browser.get("http://work:8081/admin/")
        sleep(1)
        self.browser.find_element(By.NAME,'account').send_keys('root')
        self.browser.find_element(By.NAME,'password').send_keys('root')
        self.browser.find_element(By.ID,'login').click()
        sleep(2)
        # self.browser.find_element(By.XPATH,'[表情]ml/body/div[1]/div/div[2]/div/div/div[1]/div/div[5]/div[1]/div/div/div/input')
        
        self.browser.find_element(By.XPATH,"[表情]ml/body/div/div[1]/div[2]/div/ul[表情][1]/a/cite").click()
        sleep(3)
        aa = self.browser.find_elements(By.XPATH,"[表情]ml/body/div/div/div[2]/div/div/div[2]/div[2]/div[1]/div[2]/table/tbody/tr")
        
        if len(aa)==0:
            print("无数据")
        else:
            
            is_bug_true=True
            for tr in aa:
                td = tr.find_element(By.XPATH,'./td[2]/div')
                title =td.
            
            
        print(aa)
        
    
    
    
if __name__ == '__main__':
    lk =LikeShopTest()
    lk.test()